package org.huntaway.material.cleaner.manager;

import org.huntaway.kernel.CurrTools;
import org.huntaway.kernel.imp.CurrToolsImp;
import org.huntaway.material.cleaner.enumerate.EnumMedia;
import org.huntaway.material.cleaner.enumerate.EnumOperate;
import org.huntaway.material.cleaner.enumerate.EnumPosition;
import org.huntaway.material.cleaner.manager.model.imp.ConfigManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class McManager {
	protected ConfigManager config=new ConfigManager();
	private final static Logger logger = LoggerFactory.getLogger(McManager.class);
	protected CurrTools curr=new CurrToolsImp();
	public int outline=20;
	private EnumPosition position=EnumPosition.W;//当前位置
	private EnumOperate operate=EnumOperate.S;//当前操作
	private EnumMedia media=EnumMedia.B;//当前路径
	public static String workDir="";
	//1，显示操作命令列表
	//2，显示媒体列表
	//3，显示位置列表
	//4，显示当前命令信息
	//5，变更当前操作
	public void display() {
		showHeader();		
		show();
		showBottom();		
	}
	public void showCurrInfo() {
		outline=40;
		showHeader();		
		log("|");
		String str="work:["+position.getCode()+"]operate:["+operate.getCode()+"]media:["+media.getCode()+"]";
		log(str);
		log(" ",outline-str.length());
		logln("|");
		showBottom();	
		outline=20;
	}
	private void showBottom() {
		log("+");
		log("-",outline);
		logln("+");
	}

	private void showHeader() {
		log("+");
		log("-",outline);
		logln("+");
	}

	public void logln(String str) {
		System.out.println(str);
	}

	public abstract void show();
	public abstract void doIt();

	public void log(String str) {
		System.out.print(str);
	}

	public void log(String str, int line) {
		for(int i=0;i<line;i++){
			log(str);
		}
	}
}
